<%@ taglib prefix="s" uri="/struts-tags" %>
<%--
  Created by IntelliJ IDEA.
  User: zhtt
  Date: 2017/4/19
  Time: 20:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>mapList</title>
    <style>
        table,tr,td{
            border:1px solid #999;padding:5px;border-collapse:collapse;letter-spacing: normal;
        }
    </style>
</head>
<body>
mapList
<h3>获取session中的值</h3>
登录用户：<s:property value="#session.loginUser.name" />
<h3>遍历数组</h3>
<ul>
    <s:iterator value="{'dd','bb','cc'}" status="st">
        <s:if test="#st.odd">
            <li style="background:#ccddff;"><s:property value="#st.index"/></li>
        </s:if><s:else>
            <li><s:property value="#st.index"/></li>
        </s:else>
    </s:iterator>
</ul>
<h3>遍历list</h3>
<p>
    <s:iterator value="list" status="l">
        <input type="checkbox" value='<s:property value="list[#l.index]"/>'><s:property value="list[#l.index]"/>
    </s:iterator>
</p>
<h3>遍历map</h3>
<p>
    <ul>
        <s:iterator value="map" status="m">
            <li>{key:<s:property value='key'/>,value:<s:property value='value'/>}</li>
        </s:iterator>
    </ul>
</p>
<h3>直接取map中的值</h3>
<p>
    <s:property value='map.name'/>：<s:property value='map.age'/>
</p>
<h3>遍历list-map</h3>
<table>
    <tr><td>序号</td><td>姓名</td><td>年龄</td><td>是否为奇数行</td><td>是否为偶数行</td><td>当前行数</td><td>是否第一行</td><td>是否最后一行</td></tr>
    <s:iterator value="mapList" status="map">
        <tr>
            <td>
                <s:property value="#map.index"/>
            </td>
            <td>
                <s:property value="name"/>
            </td>
            <td>
                <s:property value="age"/>
            </td>
            <td>
                <s:property value="#map.odd"/>
            </td>
            <td>
                <s:property value="#map.even"/>
            </td>
            <td>
                <s:property value="#map.count "/>
            </td>
            <td>
                <s:property value="#map.first "/>
            </td>
            <td>
                <s:property value="#map.last "/>
            </td>
        </tr>
    </s:iterator>
</table>
<h3>遍历嵌套list</h3>
<table>
    <s:iterator value="mapListList" status="mapList">
        <tr>
            <td style="background: #bbb" colspan="3">这是第<s:property value="#mapList.count"/>组人员</td>
        </tr>
        <s:iterator value="mapList" status="map">
            <tr>
                <td><s:property value="#map.count"/> </td>
                <td><s:property value="name"/> </td>
                <td><s:property value="age"/> </td>
            </tr>
        </s:iterator>
    </s:iterator>
</table>
<h3>遍历嵌套map</h3>
<table>
    <s:iterator value="mapListMap" status="mapList">
        <tr>
            <td style="background: #bbb" colspan="3">这是第<s:property value="#mapList.count"/>组人员（<s:property value="key"/> ）</td>
        </tr>
        <s:iterator value="mapList" status="map">
            <tr>
                <td><s:property value="#map.count"/> </td>
                <td><s:property value="name"/> </td>
                <td><s:property value="age"/> </td>
            </tr>
        </s:iterator>
    </s:iterator>
</table>
</body>
</html>
